<?php

use app\common\services\StaticServices;
use yii\helpers\Url;

?>

<?= Yii::$app->view->renderFile('@app/modules/admin/views/common/tab_recommend.php', ['tab' => 'index']) ?>
<div class="panel-content">
  <table class="ui selectable celled table">
    <input type="hidden" name="_csrf" id='csrf' value="<?= Yii::$app->request->csrfToken ?>">

    <script type="text/plain" id="upload_ue"></script>
    <thead>
    <tr>
      <th>客户姓名</th>
      <th>推荐人姓名</th>
      <th>实际跟进人姓名</th>
      <th>客户状态</th>
      <th>客户备注</th>
      <th>创建时间</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>

    <?php if ($list): ?>
      <?php foreach ($list as $item): ?>
        <tr>
          <td>
            <?= $item['member_name'] ?>
          </td>
          <td>
            <?= $item['recommend_name'] ?>
          </td>
          <td>
            <?= $item['opertion_name'] ?>
          </td>
          <td>
            <button class="tiny ui member_status button">
              <?= (StaticServices::getRecommendStatus())[$item['recommend_type']] ?>
            </button>
          </td>
          <td>
            <?= $item['remark'] ?>
          </td>
          <td>
            <?= date('Y-m-d', $item['create_time']) ?>
          </td>
          <td>
            <?php if ($item['recommend_type'] == 0): ?>
              <a href="javascript:void (0)"><i class="trash alternate icon _del"
                                               data-status="<?= $item['recommend_type'] ?>"
                                               data-id="<?= $item['id'] ?>"></i></a>
            <?php else: ?>
              <a href="<?= Url::to(['/admin/recommend/set', 'id' => $item['id']]) ?>"><i class="edit icon"></i></a>
              <a href="javascript:void (0)"><i class="trash alternate icon _del"
                                               data-status="<?= $item['recommend_type'] ?>"
                                               data-id="<?= $item['id'] ?>"></i></a>
            <?php endif; ?>
          </td>
        </tr>
      <?php endforeach; ?>
    <?php else: ?>
      <tr>
        <td colspan="5">暂无数据</td>
      </tr>
    <?php endif; ?>
    </tbody>

  </table>
</div>
<?= Yii::$app->view->renderFile('@app/modules/admin/views/common/page.php', ['total_page' => $total_page, 'p' => $p, 'url' => '/admin/recommend/index']) ?>
<script type="text/javascript">
  require(['modules/recommend/index'], function (index) {
    index.recommend_del()
  })
</script>